{extend name="admin@index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">订单管理</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"
               data-auth-add="{:$auth->check('order.order1/add')}"
               data-auth-edit="{:$auth->check('order.order1/edit')}"
               data-auth-delete="{:$auth->check('order.order1/del')}"
        ></table>
    </div>
</div>
<script type="text/html" id="picTpl">
    <img style="max-width:80px; max-height:30px;" src="{{d.member_info.avatarUrl}}" data-image="{{d.nickname}}">
</script>
<!--status 1待支付 2待发货 3待收货 4已完成 5已评价 6售后退货 7已取消  pay_status 0未支付 1已支付 2已退款 is_tui 0未退 1已退-->
<script type="text/html" id="barTool">
    <a data-open='{:url("goods_list")}?id={{d.order_info.id }}'
       class="layui-btn layui-btn-xs {:$auth->check('order.order1/goods_list')?'':'layui-hide'}"
       title="订单商品">订单商品</a>
</script>


<!--操作模板-->

{/block}
{block name="script"}
<script>
    var selectElement = null;
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: "{:url('add')}",
            edit_url: "{:url('edit')}",
            delete_url: "{:url('del')}",
        };
        var proviec = {:json_encode($proviec)};
        table.render({
            init: init,
            autoWidth: true,
            search:false,
            toolbar: ['refresh',],
            url: '{:url("porder")}?id={$id}',
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'id', width: '8%', title: 'ID',search:false},
                    // {field: 'order_info.order_no', align: "center", width: '18%', title: '订单编号'},
                    {field: 'member_info.nickname', align: "center", width: '20%', title: '下单会员'},
                    {field: 'member_info.avatarUrl', align: "center", width: '20%', title: '用户头像', templet: '#picTpl',search:false},
                    {field: 'activity_id', align: "center", width: '20%', title: '助力活动id'},
                    {field: 'member_info.mobile', align: "center", width: '20%', title: '会员电话'},
                    // {
                    //     field: 'role', align: "center", width: '10%', title: '角色', templet: function (d) {
                    //         if (d.role == 1) {
                    //             return '<span style="color:  #00B7EE">发起人</span>';
                    //         } else if (d.role == 2) {
                    //             return '<span style="color: #00B83F ">参与人</span>';
                    //         } else {
                    //             return '<span>未知</span>';
                    //         }
                    //     }, selectList: {1:'进行中',2:'助力成功',3:'待收货'}
                    // },
                    {field: 'create_time', align: "center", width: '30%', title: '助力时间'},
                    // { fixed: 'right',align: 'center',width: '20%', title: '操作',toolbar: '#barTool' }
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        // selectElement = document.getElementById('c-province');
        // selectElement.setAttribute("lay-filter", "c-province");
        // form1();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
        var element = document.getElementById('layui-input-search');
        element.parentNode.removeChild(element);

    });

    function form1() {
        layui.use('form', function () {
            var form = layui.form;
            form.on('select(c-province)', function (data) {
                console.log(data.value);
                $.ajax({
                    type: "POST",//规定传输方式
                    url: "{:url('getc_cate')}",//提交URL
                    data: {'id': data.value},//提交的数据
                    success: function (result) {
                        if (result.code == 200) {
                            $("#c-city").empty();
                            var str = "<option value>- 全部 -</option>";
                            $.each(result.data, function (i, val) {
                                str += '<option value=' + val.id + '>' + val.name + '</option>'
                            });
                            $("#c-city").append(str);
                            layui.form.render('select');
                        }
                    },
                    error: function () {
                        alert("获取信息失败")
                    }
                });
            })
        });
    }


</script>
{/block}